import { getEncodeHeader } from '@/tool/authUtils';
import axios from '@/tool/requestUtils'
import { BiliResponseType, RoomInfoType } from '@/types/types';
import { AxiosResponse } from 'axios';
import { ref } from 'vue'

const bapi = axios.create({baseURL: "/biliapi"})

//连接直播间
export function postStart(params: any){
    let header = getEncodeHeader(params)
    return bapi.post<BiliResponseType<RoomInfoType>>('/v2/app/start', params, {headers: header})  
}

//关闭连接
export function postEnd(params: any) {
    let header = getEncodeHeader(params)
    return bapi.post<BiliResponseType>('/v2/app/end', params, {headers: header})
}

//发送心跳包
export function postHeartBeat(params: any) {
    let header = getEncodeHeader(params)
    return bapi.post<BiliResponseType>('/v2/app/heartbeat', params, {headers: header})
}